package com.sayyi.demo.micro.order.service;

import com.sayyi.demo.micro.order.entity.OrderTbl;
import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

@LocalTCC
public interface OrderTccService {

    /**
     *
     * @param actionContext 调用方传递null即可
     * @param orderTbl
     * @return
     */
    @TwoPhaseBusinessAction(name = "OrderTccCreateOrder")
    int createOrder(BusinessActionContext actionContext,
                    @BusinessActionContextParameter(paramName = "orderTbl") OrderTbl orderTbl);

    void commit(BusinessActionContext actionContext);

    void rollback(BusinessActionContext actionContext);
}
